package com.luochen.cdpt.eneity;

import lombok.Getter;
import lombok.Setter;

import java.util.List;

/**
 * @Auther: star
 * @Date: 2018/12/14 11:20
 * @Description:
 */
@Setter
@Getter
public class Page<T> {
    private String status;
    private String message;
    private int totalCount;
    private List<T> dataList;

    public static <T> Page<T> of(int totalCount,List<T> list){
            Page page = new Page();
            page.setStatus("0");
            page.setMessage("调用成功");
            page.setTotalCount(totalCount);
            page.setDataList(list);
            return page;
    }

    public static <T> Page<T> error(String msg) {
        Page page = new Page();
        page.setStatus("-1");
        page.setMessage(msg);
        return page;
    }
}
